/*
 * Copyright (c) 2014 laidian. All Rights Reserved.
 * @author yaoyuming
 * @date  2020-08-03 14:15
 */
package com.yao.mp;

import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.generator.config.FileOutConfig;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;

import cn.hutool.core.util.StrUtil;

/**
 * @author yaoyuming
 * @date 2020/08/03 14:15
 */
public class FileWriteConfig extends FileOutConfig {

    public FileWriteConfig(String templatePath) {
        super(templatePath);
    }

    @Override
    public String outputFile(TableInfo tableInfo) {
        System.out.println("getTemplatePath() = " + getTemplatePath());

//            FreemarkerUtil.createCode("dto_template.ftl", destFile + "temp/" + module + "/entity/dto/" + className + "Dto.java", e);
        String name = StrUtil.subAfter(tableInfo.getName(), "_", false);
        return System.getProperty("user.dir") + "/src/main/java/" + "temp/" + "/entity/dto/" + name +"Dto"+ StringPool.DOT_JAVA;
//        return System.getProperty("user.dir") + "/src/main/java/" + tableInfo.getControllerName() + StringPool.DOT_XML;
    }

}